/**
 * @project readnote
 * @Title LoginInfo.java
 * @deprecated 用户登录成功后，记录当前登录者相关信息
 * @author huxh
 * @date 2012-2-20
 **/
package com.cr.backbone.action;

import java.io.Serializable;
import java.util.Date;

import com.opensymphony.xwork2.ActionContext;
import com.readnote.user.model.User;
import com.readnote.user.model.UserInfo;

/**
 * 用户登录信息对象
 * @author huxh
 *
 */
public class LoginInfo implements Serializable{
	private static final long serialVersionUID = 2385318010652126714L;
	
	private User user=null;			//用户帐号
	private UserInfo userInfo=null;	//用户信息
	
	private Date startTime=null;//登录时间
	private Date endTime=null;//登出时间
	private boolean isLogin=false;//是否登录
	
	/**
	 * 登录
	 * @param user
	 * @param userInfo
	 */
	public void login(User user,UserInfo userInfo){
		setUser(user);
		setUserInfo(userInfo);
		setStartTime(new Date());
		isLogin=true;
	}
	
	/**
	 * 登出
	 */
	public void logonOut(){
		setUser(null);
		setUserInfo(null);
		setStartTime(new Date());
		isLogin=false;
	}
	
	/**
	 * 获取当前登录用户User
	 * @return
	 */
	public User getUser() {
		return user;
	}
	
	
	public void setUser(User user) {
		this.user = user;
	}
	
	/**
	 * 获取当前登录者UserInfo
	 * @return
	 */
	public UserInfo getUserInfo() {
		return userInfo;
	}
	
	public void setUserInfo(UserInfo userInfo) {
		this.userInfo = userInfo;
	}
	public Date getStartTime() {
		return startTime;
	}
	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}
	public Date getEndTime() {
		return endTime;
	}
	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public boolean isLogin() {
		return isLogin;
	}

	
	
	
}
